package io;


import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.StandardCharsets;

public class ReadStringDemo1 {
    public static void main(String[] args) throws IOException {
     File file  =new File("text.txt");
     FileInputStream  fis  = new FileInputStream(file);//基于File文件
     byte[]data= new byte[(int)file.length()];
     fis.read(data);
     String  str = new String(data, StandardCharsets.UTF_8);
     System.out.println(str);
     fis.close();
    }
}